Skip to content

Add calculator input validation#1241

Open
liceblue wants to merge 1 commit into
thinkswell:masterfrom
liceblue:CalculatorValidation-liceblue
Open

Add calculator input validation#1241
liceblue wants to merge 1 commit into
thinkswell:masterfrom
liceblue:CalculatorValidation-liceblue

Conversation

@liceblue

@liceblue liceblue commented Jul 6, 2026

Copy link
Copy Markdown

Fixes #1164

Added input validation and error handling for the Calculator/saikrishna823 project.

Changes:

  • Shows "Invalid input" for empty or malformed expressions.
  • Shows "Cannot divide by zero" for division by zero.
  • Clears error state when users enter a new value or press clear.
  • Adds a small error style for invalid results.

Tested:

  • 1+2 returns 3
  • Empty input shows Invalid input
  • 1++2 shows Invalid input
  • 5/0 shows Cannot divide by zero
  • Clear button resets the display

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lack of Input Validation and Error Handling in Calculator

1 participant